function [ MaxRe ] = Retracement( data,pos )
%   RETRACEMENT Summary of this function goes here
%   Retracement.M主要是计算对应的仓位带来的最大回撤率

%% 最大回撤率计算
cumR = Return (data,pos);
MaxRe(1) = 0;
for i=2:length(cumR)
    MaxR = max(cumR(1:i));
    if (MaxR-cumR(i))>MaxRe(i-1)
        MaxRe(i) = MaxR-cumR(i);
    else
        MaxRe(i) = MaxRe(i-1);
    end
end


end

